package greetings

import (
	"fmt"
	"log"
	"time"

	"github.com/spf13/viper"
)

func PropertiesConfigDemo(f string) {

	viper.SetConfigName("config")
	viper.SetConfigFile(f)

	//监听文件的变动
	viper.WatchConfig()

	if err := viper.ReadInConfig(); err != nil {
		log.Fatal(err)
	}

	for {

		fmt.Println("server:", viper.Get("zookeeper.servers"))
		fmt.Println("remark:", viper.Get("zookeeper.remark"))

		time.Sleep(5 * time.Second)
	}
}
